package vip.liux.contracts.repositories.product;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.ListCrudRepository;
import org.springframework.data.repository.ListPagingAndSortingRepository;
import org.springframework.data.repository.NoRepositoryBean;
import vip.liux.contracts.models.product.Product;
import vip.liux.contracts.shared.enums.Status;

import java.util.Collection;
import java.util.List;
import java.util.Optional;

@NoRepositoryBean
public interface ProductRepository extends ListPagingAndSortingRepository<Product, Long>, ListCrudRepository<Product, Long> {
    Optional<Product> findBySpu(String spu);

    Page<Product> findByCatNo(String catNo, Pageable page);

    Page<Product> findAll(String productName, String spu, String catNo, String brandNo, Status status, Pageable page);

    long deleteBySpu(String spu);

    int updateStatusBySpuIn(List<String> canUpdate, Status status);

    List<Product> findBySpuIn(Collection<String> spus);
}